﻿@model Lian3.Models.Student1

@{
    ViewBag.Title = "Index2";
}

<h2>Index2</h2>


@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    @*防止别人伪造，控制器也要写[ValidateAntiForgeryToken]*@

<div class="form-horizontal">
    <h4>Student1</h4>
    <hr />
    @Html.ValidationSummary(true, "", new { @class = "text-danger" })
    @*显示ModelState.AddModelError("", "操作有误");*@
    <div class="form-group">
        @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
            @*这个错误是Student1中的[EmailAddress]，如果出错显示的错误消息  *@
        </div>
    </div>

    <div class="form-group">
        @Html.LabelFor(model => model.Pow, htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.EditorFor(model => model.Pow, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.Pow, "", new { @class = "text-danger" })
        </div>
    </div>

    <div class="form-group">
        <div class="col-md-offset-2 col-md-10">
            <input type="submit" value="Create" class="btn btn-default" />
        </div>
    </div>
</div>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
